/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2023-06-10     团       the first version
 */
#include <rtthread.h>
#include "led.h"
#include "board.h"

#define LED_PIN_B GET_PIN(A, 3)
#define LED_PIN_G GET_PIN(A, 4)
#define LED_PIN_R GET_PIN(A, 5)

/**
 * @brief    该函数用于点亮LED灯
 * @note     如果改变LED引脚，请在本文件的头部修改宏定义
 * @param    传入的参数为LED_FLAG,用于设置LED灯的状态
 *                               传入的参数:
 *               LED_ON_B          打开蓝色LED灯
 *               LED_ON_G          打开绿色LED灯
 *               LED_ON_R          打开红色LED灯
 *               LED_OFF           关闭LED灯
 * @return   无返回值
 */
void led_set(int LED_FLAG)
{
    rt_pin_mode(LED_PIN_B, PIN_MODE_OUTPUT);
    rt_pin_mode(LED_PIN_G, PIN_MODE_OUTPUT);
    rt_pin_mode(LED_PIN_R, PIN_MODE_OUTPUT);
    switch(LED_FLAG)
    {
        case 0:
            rt_pin_write(LED_PIN_B, 0);
            rt_pin_write(LED_PIN_G, 0);
            rt_pin_write(LED_PIN_R, 0);
            break;
        case 1:
            rt_pin_write(LED_PIN_B, 1);
            break;
        case 2:
            rt_pin_write(LED_PIN_G, 1);
            break;
        case 3:
            rt_pin_write(LED_PIN_R, 1);
            break;
    }

}



